const object = require('json-templater/object')
const string = require('json-templater/string')

let out = object(
  require('./template.json'),
  {
    magic: 'key',
    value: 'value123'
  },
  function(value, data, key) {
    // custom renderer for some special value
    if (key === 'specialKey') {
      return 'foo'
    }
    // usual string renderer
    return string(value, data)
  }
)

let str = string('{{xfoo}} {{say.what}}', {
  xfoo: 'yep',
  say: {
    what: 'yep'
  }
})

console.log(out)
console.log()
console.log(str)
